/********************************************************************
	created:	2010/11/15
	created:	15:11:2010   15:12
	filename: 	e:\SVN\服务器端\Source\ModLogin\async_func.cpp
	file path:	e:\SVN\服务器端\Source\ModLogin
	file base:	async_func
	file ext:	cpp
	author:

	purpose:
*********************************************************************/

#include "async_func.h"

// 异步处理函数
//void AsyncProc_Plaayer(CMsgTyped* pmsg, CADODatabase* pDatabase)
void AsyncProc_Plaayer( CMsgTyped* pmsg,  sql::Statement* pConn )
{
	if (!pmsg)
	{
	    _Debug("Null message.\n");
		return;
	}

	if (!pConn)
	{
	    _Debug("Database connection is null.\n");
		return;
	}

	bool bIsSuccess=false;
    string sqlStr = pmsg->StringVal();
	try
	{
        //pConn->execute("use Nx_Log;"); //spec hack
        bIsSuccess = pConn->executeUpdate(sqlStr);
        if (!bIsSuccess)
        {
            _Debug("executing %s fails.\n", sqlStr.c_str());
        }
	}
	catch(sql::SQLException &e)
	{
        _Debug("error: %s when executing %s.\n", e.what(), sqlStr.c_str());
	}
	catch(...)
	{
        _Debug("unknown exception when executing %s.\n", sqlStr.c_str());
	}
}
